import { getCart } from "@/api/cart";
const state = {
  cartNum: 0,
};
const mutations = {
  addCart(state, data) {
    state.cartNum = data;
  },
};
const getters = {};
const actions = {
  async updateCart({ commit }) {
    await getCart().then((res) => {
      commit("addCart", res.data.length || 0);
    });
  },
};
export default {
  state,
  mutations,
  getters,
  actions,
};
